package com.example.duanlei417.mypro2.login;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;

import com.example.duanlei417.mypro2.R;
import com.example.duanlei417.mypro2.login.lib_login.annotation.LoginFilter;
import com.example.duanlei417.mypro2.login.utils.SharePreferenceUtil;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_login);
        findViewById(R.id.btn_function).setOnClickListener(this);
    }

    @LoginFilter
    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.btn_function:
                startActivity(new Intent(this, SecondActivity.class));
                break;
        }
    }

    public void skipNoLogin(View view) {
        startActivity(new Intent(this, ThirdActivity.class));
    }

    public void skipLoginFilter(View view) {
        startActivity(new Intent(this, ExtendsLoginFilterActivity.class));
    }

    public void clearLoginInfo(View view) {
        SharePreferenceUtil.clearSharePref(SharePreferenceUtil.IS_LOGIN, this);
        Toast.makeText(this, "清除登录信息成功！", Toast.LENGTH_SHORT).show();
    }
}
